% This function computes consumption utility

function utility = u_c(c, rho, crra)

if crra==1
    if rho ~= 1
        utility = (c.^(1-rho)-1)./(1-rho);
    elseif rho==1
        utility = log(c);
    end
elseif crra==0
    utility = 1-exp(-rho*c);
end
